-
-
Notifications
You must be signed in to change notification settings - Fork 9k
feat(complier-sfc): add hoistStatic for <script setup>
#5752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
❌ Deploy Preview for vuejs-coverage failed.
|
✅ Deploy Preview for vue-next-template-explorer ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for vue-sfc-playground ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
script setup
|
If this feature is acceptable, I will add a Unit Test for it later. |
|
This is great. Let's add some tests for it |
|
I'm considering whether this feature is enabled by default, or is it an experimental feature and not enabled by default? |
|
@yyx990803 Added. |
script setup<script setup>
<script setup>hoistStatic for <script setup>
packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap
Outdated
Show resolved
Hide resolved
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
I think this may have introduced a regression: #7973. I'm not sure of the cause, but testing locally it seems to work fine prior to this being merged. |
- Support using literal constants in macros - fix useCssVars insert position edge case - fix non-literal-const enum hoisting close vuejs#5750
closes #5750
Introduce a option
hoistStaticinscript.Only enables when there's only one
<script setup>(enabled by default)Fix these cases
_useCssVarsshould be put inside ofsetupBefore | After
enumshouldn't be hoistedBefore | After
Demo